#include <iostream>

using namespace std;

class Person {
 public:
  Person() { cout << "初始化Person" << endl; }
  ~Person() { cout << "释放" << endl; }

 private:
  int value_;
  friend void ShowPrivate(Person); // 友元函数不是类函数

 protected:
  void ShowProtected() { cout << "展示Protect方法" << endl; }
};

class Man : public Person {
 public:
  Man() { cout << "初始化Man" << endl; }
  ~Man() { cout << "释放Man" << endl; }
  void testDemo() {}

 private:
  friend class Person;
};

void ShowPrivate(Person p) { p.value_; }

void demo() {
  Man mp;
  // Man * mp = new Man();
  mp.testDemo();
  ShowPrivate(mp);
}

int main(int argc, char** argv[]) {
  demo();
  return 0;
}